 package com.xinzhi.service.impl;

import com.xinzhi.mapper.AppraisalssMapper;
import com.xinzhi.pojo.dto.JiaFenShenHe;
import com.xinzhi.service.AppraisalssService;
import com.xinzhi.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AppraisalssServiceImpl implements AppraisalssService {
    @Autowired
    private AppraisalssMapper appraisalssMapper;

    /**
     * 特殊加分审核的查询接口
     *
     * @return
     */
    @Override
    public List<JiaFenShenHe> selectAllsss() {
        return appraisalssMapper.selectJia();
    }

    /**
     * 特殊加分审核根据发布状态查询接口
     *
     * @param publishstatus
     * @return
     */
    @Override
    public Result selectpublish(String publishstatus) {
        List<JiaFenShenHe> selectpublish = appraisalssMapper.selectpublish(publishstatus);
        if (publishstatus == null) {
            return Result.error("传入的值不能为空");
        } else {
            return Result.ok(selectpublish);
        }
        /**
         * 特殊加分审核删除接口
         * @param poinexe
         * @param deleted
         * @return
         */



    }

    @Override
    public Result deleteupdate(String poinexe, Integer deleted) {
        if (poinexe == null && deleted == 0) {
            return Result.error("参数错误");
        }
        int deleteupdate = appraisalssMapper.deleteupdate(poinexe, deleted);
        return deleteupdate > 0 ? Result.ok("删除成功") : Result.error("删除失败");
    }
}
